<template>
  <div class="shop">
    <img class="shop__img" :src="item.imgUrl" :alt="item.name" />
    <!-- 右边 -->
    <div
      :class="{
        shop__content: true,
        'shop__content--bordered': hideBorder ? false : true,
      }"
    >
      <div class="shop__content__title">{{ item.name }}</div>
      <div class="shop__content__tags">
        <span class="shop__content__tag">月售: {{ item.sales }} </span>
        <span class="shop__content__tag">起售: {{ item.expressLimit }} </span>
        <span class="shop__content__tag"
          >初始运费: {{ item.expressPrice }}</span
        >
      </div>
      <p class="shop__content__highlight">
        {{ item.slogan }}
      </p>
      <!-- 右下 -->
      <div class="shop__products" v-if="item.products">
        <div
          v-for="product in item.products"
          :key="product.name"
          class="shop__product"
        >
          <img class="shop__product__img" :src="product.imgUrl" alt="" />
          <p class="shop__product__title">{{ product.name }}</p>
          <div class="shop__product__info">
            <span class="shop__product__info__price">
              &yen;{{ product.price }}
            </span>
            <span class="shop__product__info__originPrice">
              &yen;{{ product.price }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ShopInfo',
  props: ['item', 'hideBorder'],
};
</script>

<style lang="scss" scoped>
@import '../style/variables.scss';
@import '../style/mixins.scss';
.shop {
  display: flex;
  padding-top: 0.12rem;
  align-items: flex-start;
  &__img {
    width: 0.56rem;
    height: 0.56rem;
    margin-right: 0.16rem;
  }
  &__content {
    flex: 1;
    padding-bottom: 0.12rem;
    &--bordered {
      border-bottom: 1px solid $content-bgColor;
    }

    &__title {
      line-height: 0.22rem;
      font-size: 0.16rem;
      color: $content-fontColor;
    }
    &__tags {
      margin-top: 0.08rem;
      line-height: 0.18rem;
      font-size: 0.13rem;
      color: $content-fontColor;
    }
    &__tag {
      margin-right: 0.16rem;
    }
    &__highlight {
      margin: 0.08rem 0 0;
      color: $highlight-fontColor;
      line-height: 0.18rem;
      font-size: 0.13rem;
    }
  }
  //
  &__products {
    display: flex;
  }
  &__product {
    margin-top: 0.08rem;
    width: 0.76rem;
    margin-right: 0.16rem;
    &__img {
      height: 0.76rem;
      margin-bottom: 0.04rem;
    }
    &__title {
      font-size: 0.12rem;
      line-height: 0.17rem;
      color: $content-fontColor;
      font-size: 0.12rem;
      @include ellipsis;
    }
    &__info {
      margin-top: 0.02rem;
      line-height: 0.2rem;
      display: flex;
      justify-content: space-around;
      vertical-align: bottom;

      &__price {
        font-size: 0.14rem;
        color: $highlight-fontColor;
      }
      &__originPrice {
        font-size: 0.1rem;
        color: $light-fontColor;
        text-decoration: line-through;
      }
    }
  }
}
</style>
